/**
* @author  jime.zhu
* @date    2021-08-03
* @brief   流程图插入点
*/
#ifndef QINSERTIONPOINT_H
#define QINSERTIONPOINT_H

#include <QtCore>
#include <QtGui>
#include <QWidget>
#include <QDomDocument>

#include "FlowChart_Global.h"

namespace CVV
{

namespace FlowChart
{

class QBlock;
/**
 * @brief 流程图插入点定义
 */
class CVV_FLOWCHART_EXPORT QInsertionPoint
{
  private:
    QPointF m_fPoint;
    QBlock *m_fBranch{nullptr};
    int m_fIndex{-1};
    bool m_bNeedDraw{false};                  //设置插入点是否需要绘制；
  public:
    QInsertionPoint()
    {
      m_fPoint = QPoint();
      m_fBranch = nullptr;
      m_fIndex = -1;
      m_bNeedDraw = true;
    }
    QPointF point() const { return m_fPoint; }
    QBlock *branch() const { return m_fBranch; }
    int index() const { return m_fIndex; }
    void setPoint(const QPointF &aPoint) { m_fPoint = aPoint; }
    void setBranch(QBlock *aBranch)
    {
        m_fBranch = aBranch;
    }
    void setIndex(int aIndex) { m_fIndex = aIndex; }
    bool needDraw(){return m_bNeedDraw;}
    void setNeedDraw(bool need){m_bNeedDraw = need;}
    bool isNull() const { return m_fPoint.isNull() && m_fBranch == nullptr && m_fIndex == -1; }
};

}

}
Q_DECLARE_TYPEINFO(CVV::FlowChart::QInsertionPoint, Q_MOVABLE_TYPE);
#endif // QINSERTIONPOINT_H
